#ifndef __EssConnector_H__
#define __EssConnector_H__

#include "EssPeer.h"
#include "EssBuffer.h"
#include <queue>

class EssConnector : public EssPeer
{
public:
	struct PacketBuffer
	{
		EssBuffer	buf;
		int			flags;
	};
	typedef std::queue<PacketBuffer*> PacketBufferList;

public:
	EssConnector();
	EssConnector(SOCKET s);
	virtual ~EssConnector();

	virtual bool connectSock(HWND wnd, UINT message, const char* ip, u_short port);
	virtual bool isConnected();

	virtual bool sendSock(const char* buf, int len, int flags = 0);
	virtual bool _dispatchSendBuffers();
	virtual void _clearSendBuffers();

	virtual int recv();
	virtual EssBuffer& getRecvBuffer();
	virtual void _clearRecvBuffer();

protected:
	PacketBufferList	mSendBuffer;
	EssBuffer			mRecvBuffer;
};

#endif //__EssConnector_H__